package com.xy.biz.ts.domain.converter;

import java.util.Collection;
import java.util.List;

import com.xy.tool.util.BeanUtilsEx;
import com.xy.biz.ts.domain.bo.ExaminationTrainRelBO;
import com.xy.biz.ts.domain.po.ExaminationTrainRelPO;
import com.xy.biz.ts.domain.query.ExaminationTrainRelQuery;
import com.xy.biz.ts.domain.resp.GetExaminationTrainRelResponse;
import com.xy.biz.ts.domain.req.SaveExaminationTrainRelRequest;
import com.xy.biz.ts.domain.req.ListExaminationTrainRelRequest;

/**
 * 
 * 
 * @author zgy
 * @date 2021-7-8
 */
public class ExaminationTrainRelConverter {
	
	public static ExaminationTrainRelPO toPO(ExaminationTrainRelBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ExaminationTrainRelPO(), true);
	}
	
	public static List<ExaminationTrainRelPO> toPO(Collection<ExaminationTrainRelBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ExaminationTrainRelPO(), true);
	}
	
	public static ExaminationTrainRelBO fromPO(ExaminationTrainRelPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ExaminationTrainRelBO());
	}
	
	public static List<ExaminationTrainRelBO> fromPO(Collection<ExaminationTrainRelPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ExaminationTrainRelBO());
	}
	
	public static ExaminationTrainRelBO toBO(SaveExaminationTrainRelRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new ExaminationTrainRelBO(), true);
	}
	
	public static List<ExaminationTrainRelBO> toBO(Collection<SaveExaminationTrainRelRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ExaminationTrainRelBO(), true);
	}
	
	public static GetExaminationTrainRelResponse toResponse(ExaminationTrainRelBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetExaminationTrainRelResponse());
	}
	
	public static List<GetExaminationTrainRelResponse> toResponse(Collection<ExaminationTrainRelBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetExaminationTrainRelResponse());
	}
	
	public static ExaminationTrainRelQuery toQuery(ListExaminationTrainRelRequest source) {
		if(null == source) {
			return null;
		}
		ExaminationTrainRelQuery target = new ExaminationTrainRelQuery(source.getPageIndex(), source.getPageSize());
		BeanUtilsEx.copyProperties(source, target);
		return target;
	}

}
